package com.zxjbyte.yiyi.framework.common.annotation;

import com.zxjbyte.yiyi.framework.common.annotation.validated.AllowedValuesValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(
        validatedBy = AllowedValuesValidator.class
)
public @interface AllowedValues {

    // 指定的值
    String[] values() default {};

    // 指定int类型数组值, 与values()互斥，优先级高
    int[] intValues() default {};

    String message() default "Value is not allowed";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
